package com.cn.aam.checaiduo.ui.product.vadapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.vlayout.LayoutHelper;
import com.alibaba.android.vlayout.layout.LinearLayoutHelper;
import com.cn.aam.checaiduo.R;
import com.cn.aam.checaiduo.base.adapter.BaseVLayoutAdapter;
import com.cn.aam.checaiduo.base.adapter.holder.BaseRecyclerViewHolder;
import com.cn.aam.checaiduo.bean.KeyValueB;
import com.cn.aam.checaiduo.bean.brandsquence.BrandDataB;
import com.orhanobut.logger.Logger;

import butterknife.BindView;

/**
 * @author 艹羊
 * @project Checaiduo_Android
 * @date 2017/6/2 下午3:44
 * @description 品牌列表
 */

public class BrandLinearAdapter extends BaseVLayoutAdapter<BrandDataB> {


    public BrandLinearAdapter(Context mContext) {
        super(mContext);
    }

    @Override
    protected BaseRecyclerViewHolder getViewHolder(View picNewsView) {
        return new MyViewholder(picNewsView);
    }

    @Override
    protected int getItemLayoutRes() {
        return R.layout.list_vitem_normal_info;
    }

    @Override
    protected void ItemViewChange(BaseRecyclerViewHolder recyclerholder, final int position) {
        MyViewholder holder = (MyViewholder) recyclerholder;
        BrandDataB item = getItem(position);
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (onItemClick != null) onItemClick.onClick(position);
            }
        });
        holder.tvKey.setText(item.getBrand());
        holder.tvValue.setText(item.getNumber() + "辆");
    }

    @Override
    public LayoutHelper onCreateLayoutHelper() {
        LinearLayoutHelper linearLayoutHelper = new LinearLayoutHelper();
        return linearLayoutHelper;
    }


    public class MyViewholder extends BaseRecyclerViewHolder {
        @BindView(R.id.tv_key)
        TextView tvKey;
        @BindView(R.id.tv_value)
        TextView tvValue;

        public MyViewholder(View view) {
            super(view);
        }
    }
}
